package com.junzhiit.nengji.cms.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bainaeco.framework.util.AssertUtil;
import com.junzhiit.nengji.cms.service.ShopHistoryService;
import com.junzhiit.nengji.cms.web.vo.ResultVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/shop/history")
public class ShopHistoryController extends BaseController{

	@Autowired ShopHistoryService shopHistoryService;
	
	@ApiOperation(value="获取所有店铺分析数据")
	@RequestMapping(value="/analysis",method=RequestMethod.GET)
	public ResultVO getShopAnalysis(String sessionId,String startTime,String endTime,String shopId){
		AssertUtil.notBlank(sessionId, "sessionId is required");
		AssertUtil.notBlank(startTime, "startTime is required");
		AssertUtil.notBlank(endTime, "endTime is required");
		return shopHistoryService.getShopAnalysis(sessionId, startTime, endTime, shopId);
	}
	
	@ApiOperation(value="获取品牌下指定时间内不同性别的买家数量")
	@RequestMapping(value="/user/sex",method=RequestMethod.GET)
	public ResultVO getUserSex(String sessionId,String startTime,String endTime,String shopId){
		AssertUtil.notBlank(sessionId, "sessionId is required");
		AssertUtil.notBlank(startTime, "startTime is required");
		AssertUtil.notBlank(endTime, "endTime is required");
		return shopHistoryService.getUserSex(sessionId,startTime,endTime,shopId);
	}
}
